import { createPinia } from 'pinia'
import { createPersistedState } from 'pinia-plugin-persistedstate'
interface AnyObject {
  [key: string]: any;
}
export const pinia = createPinia().use(
  createPersistedState({
    storage: {
      getItem(key: string): string | null {
        return uni.getStorageSync(key)
      },
      setItem(key: string, value: string | number | boolean | AnyObject) {
        uni.setStorageSync(key, value)
      }
    }
  })
)